//
//  HTSearchReducer.swift
//  MagaCore
//
//  Created by MrMessy on 2023/5/14.
//

import Foundation
import ReSwift

struct HTSearchReducer {
  static var var_reducer: Reducer<HTSearchState> {
    return { action, state in
      var state = state ?? HTSearchState()
      guard let action = action as? HTEnumSearchAction else {
        return state
      }
      switch action {
      case .htEnumPopulars(var_populars: let var_populars):
        state.var_populars = var_populars
        return state
      case .htEnumSearchList(var_searchAnimes: let var_searchAnimes):
        state.var_searchAnimes = var_searchAnimes
        return state
      case .htEnumSearchHistory(var_searchHistory: let var_searchHistory):
        state.var_searchHistory = var_searchHistory
        return state
      }
    }
  }
}
